package org.domain.sigepac.Entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Embeddable
public class AvaliacaoPsicogeneseId implements Serializable {

	private static final long serialVersionUID = -4381266768047271619L;

	@Column(name = "id_aluno", nullable = false)
	private Integer idAluno;

	@Column(name = "id_psicogenese", nullable = false)
	private Integer idPsicogenese;
	
	@Column(name = "id_turma", nullable = false)
	private Integer idTurma;
	
	@Column(name="data",nullable=false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date data=new Date();

	public Integer getIdAluno() {
		return idAluno;
	}
	
	public void setIdAluno(Integer idAluno) {
		this.idAluno = idAluno;
	}
	
	public Integer getIdPsicogenese() {
		return idPsicogenese;
	}
	
	public void setIdPsicogenese(Integer idPsicogenese) {
		this.idPsicogenese = idPsicogenese;
	}
	
	public Integer getIdTurma() {
		return idTurma;
	}
	public void setIdTurma(Integer idTurma) {
		this.idTurma = idTurma;
	}
	
	public Date getData() {
		return data;
	}
	public void setData(Date data) {
		this.data = data;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((data == null) ? 0 : data.hashCode());
		result = prime * result + ((idAluno == null) ? 0 : idAluno.hashCode());
		result = prime * result
				+ ((idPsicogenese == null) ? 0 : idPsicogenese.hashCode());
		result = prime * result + ((idTurma == null) ? 0 : idTurma.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AvaliacaoPsicogeneseId other = (AvaliacaoPsicogeneseId) obj;
		if (data == null) {
			if (other.data != null)
				return false;
		} else if (!data.equals(other.data))
			return false;
		if (idAluno == null) {
			if (other.idAluno != null)
				return false;
		} else if (!idAluno.equals(other.idAluno))
			return false;
		if (idPsicogenese == null) {
			if (other.idPsicogenese != null)
				return false;
		} else if (!idPsicogenese.equals(other.idPsicogenese))
			return false;
		if (idTurma == null) {
			if (other.idTurma != null)
				return false;
		} else if (!idTurma.equals(other.idTurma))
			return false;
		return true;
	}
	
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return idAluno+"-"+idPsicogenese+"-"+idTurma+"-"+data.toString();
	}
}
